package com.homework.service;

import com.homework.dao.CatDaoImpl;
import com.homework.entity.Cat;
import com.homework.dao.CatDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("catService")
public class CatServiceImpl implements CatService {

//    @Autowired
//    @Qualifier("catDao")
    @Resource
    private CatDao catDao;
    @Override
    public void insertCat(Cat c) {
        System.out.println("CatServiceImpl.insertCat");
        catDao.insertCat(c);
    }

    @Override
    public void updateCat(Cat c) {
        System.out.println("CatServiceImpl.updateCat");
        catDao.updateCat(c);
    }

    @Override
    public void deleteCat(Integer cno) {
        System.out.println("CatServiceImpl.deleteCat");
        catDao.deleteCat(cno);
    }

    @Override
    public Cat selectCat(Integer cno) {
        System.out.println("CatServiceImpl.selectCat");
        return catDao.selectCat(cno);
    }

    @Override
    public List<Cat> selectList() {
        System.out.println("CatServiceImpl.selectList");
        System.out.println(catDao);
        return catDao.selectList();
    }

    @Override
    public void upload(Cat c) {
        System.out.println("CatServiceImpl.upload");
        catDao.upload(c);
    }
}
